package com.gl.glcourses.repository.impl;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.gl.glcourses.repository.dao.IAdjuntoRepository;
import com.gl.glcourses.repository.dao.IPublicoObjetivoRepository;
import com.gl.glcourses.repository.dao.ITipoRecursoRepository;
import com.gl.glcourses.vos.Adjunto;
import com.gl.glcourses.vos.TipoRecurso;

@Repository
public class JpaTipoRecursoRepository extends JpaProjectRepository<TipoRecurso> implements ITipoRecursoRepository<TipoRecurso>{
    
	@PersistenceContext
	protected EntityManager em;

public TipoRecurso findTipoRecurso( TipoRecurso parametro) {
		
	    TipoRecurso objeto = null;
		try {

			Query query = em.createQuery("FROM " + TipoRecurso.class
					+ " as objeto WHERE objeto." + " = :param");
			query.setParameter("param", parametro);
			return objeto = (TipoRecurso) query.getSingleResult();

		} catch (Exception e) {
			return null;
		}
	}
	
}




